package sdufe.lele.dao;

import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import sdufe.lele.model.Broker;

import java.util.ArrayList;

@Mapper
@Repository
public interface BrokerMapper {


    int deleteByPrimaryKey(Integer brokerid);


    int deleteByName(String name);

    @Insert("insert into broker (brokerName,brokerUserPhone) values (#{brokername},#{brokeruserphone})")
    int insertSelective(Broker record);


    Broker selectByPrimaryKey(Integer brokerid);


    @Select("select * from broker")
    @Results({
            @Result(id = true, column = "brokerId", property = "brokerid"),
            @Result(column = "brokerName", property = "brokername"),
    })
    ArrayList<Broker> selectAll();

    @Select("select * from broker where brokerUserPhone= #{phone}")
    @Results({
            @Result(id = true, column = "brokerId", property = "brokerid"),
            @Result(column = "brokerName", property = "brokername"),
    })
    ArrayList<Broker> selectAllByPhone(String phone);


    int updateByPrimaryKeySelective(Broker record);



    int updateByName(String oldBrokerName,String newBrokerName);
}